s = input("Введите скобочную последовательность:")
a = []
t = True
for i in s:
    if i in '({[':
        a.append(i)
    elif i in ')}]':
        if not a:
            t = False
            break
        o=a.pop()
        if o =='(' and i==')':
            continue
        if o =='{' and i=='}':
            continue
        if o =='[' and i==']':
            continue
        if o =='<' and i=='>':
            continue
        t = False
        break
if t and len(a)==0:
    print('True')
else:
    print('False')
        
        
            
        
